<?php echo $header; ?>
<!-- MAIN CONTAINER -->
	<div id="ja-container" class="wrap ja-r1">
		<div class="main">	
			<div class="ja-rs2-top">
				<div class="ja-rs2-tl">&nbsp;</div>
				<div class="ja-rs2-tr">&nbsp;</div>
			</div>
			
			<div class="ja-rs2-mid">
				<div class="ja-rs2-ml">
					<div class="ja-rs2-mr clearfix">
						<div id="ja-mainbody" style="width:70%">
						<div id="ja-main" style="width:100%">
								<div class="inner clearfix">	
									<div id="ja-contentwrap" class="ja-r1">
			<!-- CONTENT -->
			<div class="ja-mass ja-mass-top clearfix">
	
			<div class="ja-rs3-top"><div class="ja-rs3-tl">&nbsp;</div><div class="ja-rs3-tr">&nbsp;</div></div>
		
				<div class="ja-rs3-mid"><div class="ja-rs3-ml"><div class="ja-rs3-mr">
					<div class="ja-moduletable moduletable title-orange  clearfix">
						
						<h3><span><strong class="first-word"><strong><?php echo $heading_title; ?></strong></strong></span></h3>
						
							<div class="ja-box-ct clearfix" style="padding-left:20px;padding-right:20px;">
							  <div class="middle"><b><?php echo $text_critea; ?></b>
							    <div id="content_search" style="background: #F7F7F7; border: 1px solid #DDDDDD; padding: 10px; margin-top: 3px; margin-bottom: 10px;">
							      <table>
							        <tr>
							          <td><?php echo $entry_search; ?></td>
							          <td><?php if ($keyword) { ?>
							            <input type="text" value="<?php echo $keyword; ?>" id="keyword" />
							            <?php } else { ?>
							            <input type="text" value="<?php echo $text_keyword; ?>" id="keyword" onclick="this.value = '';" onkeydown="this.style.color = '000000'" style="color: #999;" />
							            <?php } ?>
							            <select id="category_id">
							              <option value="0"><?php echo $text_category; ?></option>
							              <?php foreach ($categories as $category) { ?>
							              <?php if ($category['category_id'] == $category_id) { ?>
							              <option value="<?php echo $category['category_id']; ?>" selected="selected"><?php echo $category['name']; ?></option>
							              <?php } else { ?>
							              <option value="<?php echo $category['category_id']; ?>"><?php echo $category['name']; ?></option>
							              <?php } ?>
							              <?php } ?>
							            </select></td>
							        </tr>
							        <tr>
							          <td colspan="2"><?php if ($description) { ?>
							            <input type="checkbox" name="description" id="description" checked="checked" />
							            <?php } else { ?>
							            <input type="checkbox" name="description" id="description" />
							            <?php } ?>
							            <?php echo $entry_description; ?></td>
							        </tr>
									
							      </table>
							    </div>
							    <div style="margin-bottom:15px;">
							      <table>
							        <tr>
							          <td align="right"><a style="cursor: pointer;padding:6px 20px;" id="change" onclick="contentSearch();" class="button"><span><?php echo $button_search; ?></span></a></td>
							        </tr>
							      </table>
							    </div>
							    <h3><?php echo $text_search; ?></h3>
							    <?php if (isset($products)) { ?>
									    <div class="sort">
									      <div class="div1">
									      <div class="div2"><?php echo $text_sort; ?>
									        <select name="sort" onchange="location = this.value">
									          <?php foreach ($sorts as $sorts) { ?>
									          <?php if (($sort . '-' . $order) == $sorts['value']) { ?>
									          <option value="<?php echo $sorts['href']; ?>" selected="selected"><?php echo $sorts['text']; ?></option>
									          <?php } else { ?>
									          <option value="<?php echo $sorts['href']; ?>"><?php echo $sorts['text']; ?></option>
									          <?php } ?>
									          <?php } ?>
									        </select></div>
									      </div>
									      
									    </div>
									     <table>
										    <?php for ($i = 0; $i < sizeof($products); $i=$i+3) { ?>
										    <tr valign="top">
										    <?php for ($j = $i; $j < $i+3; $j++) { ?>
										    <td><?php if (isset($products[$j])) { ?>
											<div class="searchresult">							
											<a href="<?php echo $products[$j]['href']; ?>"><img width="200" height="150" alt="<?php echo $products[$j]['name']; ?>" title="<?php echo $products[$j]['name']; ?>" src="<?php echo $products[$j]['thumb']; ?>" /></a>
											<div class="shadow-small"></div>			
											<div class="namedisplay"><?php echo $products[$j]['name'];?> </div>
														
											</div><!-- end post -->
											</td>
											<?php }?>
											<?php }?>
											
											</tr>
											<?php }?>
										</table>
										<div style="clear:both;width:100%;"></div>
										<div class="pagination"><?php echo $pagination; ?></div>
										<?php } else { ?>
							    <div style="background: #F7F7F7; border: 1px solid #DDDDDD; padding: 10px; margin-top: 3px; margin-bottom: 15px;"><?php echo $text_empty; ?></div>
							    <?php }?>
							  </div>
 							</div></div></div></div></div>
		
							<div class="ja-rs3-bot"><div class="ja-rs3-bl">&nbsp;</div><div class="ja-rs3-br">&nbsp;</div></div>
					</div>
					</div>
				</div>
			</div>
	<!-- //CONTENT -->
			</div>
		<!-- RIGHT COLUMN-->
		<?php echo $column_right; ?>
		<!-- END RIGHT COLUMN--> 
	</div></div></div></div></div>
<script type="text/javascript"><!--
jQuery('#content_search input').keydown(function(e) {
	if (e.keyCode == 13) {
		contentSearch();
	}
});

function contentSearch() {
	url = 'index.php?route=product/search';
	
	var keyword = jQuery('#keyword').attr('value');
	
	if (keyword) {
		url += '&keyword=' + encodeURIComponent(keyword);
	}

	var category_id = jQuery('#category_id').attr('value');
	
	if (category_id) {
		url += '&category_id=' + encodeURIComponent(category_id);
	}
	
	if (jQuery('#description').attr('checked')) {
		url += '&description=1';
	}
	
	location = url;
}
//--></script>
<?php echo $footer; ?> 